package strings;

/**
 * General interface for Aho-Corasick type algorithms, which perform
 * exact matching for a set of strings.
 */


public interface SetMatch {

    /**
     * General search method. Search results are reported through the
     * Match action.
     * @param input to be searched
     */
     void search(CharIterator input);


    /**
     * Add a new String to the set of patterns. Here, an alternative
     * approach might be to have the constructor take an array or List
     * of patterns. But it might be useful to be able to add new words
     * and recompile.
     * @param patternWord a word (string) added to set to search for
     */
    void put(String patternWord);

    /**
     * Define what to do when a match occurs. A somewhat different
     * approach is used by www.mcdowella.demon.co.uk/programs.html, in
     * which there is a separate callback instance for each pattern.
     * @param ma is a MatchAction used as callback
     */
    void setMatchAction(MatchAction ma);


    /**
     * Compilation is necessary whenever new patterns are added. But
     * compilation should not be necessary after resetting the
     * MatchAction.
     */
    void compile();


}
